<%@page import="dao.MsgDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="model.Admin" %>
<%@ page import="java.util.List" %>



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>管理员页面</title>

<link href="../css/Utils.css" rel="stylesheet" type="text/css" />
<link href="../css/List.css" rel="stylesheet" type="text/css" />
<%--  ${sessionScope.admin.id}! --%>
</head>
<body>

<!-- 头部 -->
<div class="header" ><br>
<nerong>&nbsp;&nbsp;管理员页面&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;</nerong>

 <button onclick="confirmLogout('<%= (String)session.getAttribute("admin") %>','admin')">退出登录</button>


<div class="left" >
<table width="80%" height="80%">
<th>
<nerong>管理员可选择内容</nerong>

</th>

<tr>
<td>
<a href="../View_Msg/msgAdmin.jsp">&emsp;个人信息</a><br>
</td>
</tr>

<tr>
<td>
<a href="../View_xx/XxStudent.jsp">&emsp;学生信息管理</a><br>
</td>
</tr>


<tr>
<td>
<a href="../View_xx/XxFdy.jsp">&emsp;辅导员信息管理</a><br>
</td>
</tr>

<tr>
<td>
<a href="../View_xx/XxSuGuan.jsp">&emsp;宿管信息管理</a><br>
</td>
</tr>


<tr>
<td>
<a href = "../View_xx/XxWy.jsp">&emsp;物业信息管理</a><br>
</td>
</tr>

<tr>
<td>
<a href = "../View_SuShe/SuSheAdminMain.jsp">&emsp;宿舍入住管理</a><br>
</td>
</tr>






</table>





</div>



<div class="context" >
<!-- 这部分是每个大功能的小功能 -->
 

  <table class="Alltable">
  <caption>个人信息</caption>
   <thead>
      <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>身份</th>
        <th>操作</th>
        <!-- 个人信息是否需要显示密码列？ -->
        <!--<th>密码</th>-->
      </tr>
    </thead>
    <tbody align="center">
      <%
        MsgDao dao = new MsgDao();
        String id = (String)session.getAttribute("admin");
       /*  if(id instanceof String){
        	String str=(String) id;
        	session.setAttribute("user",str);
        } */
      
        List<Admin> users = dao.getAloneAdminMessage(id);
        if (users != null && !users.isEmpty()) {
          for (Admin user : users) {
      %>
      <tr>
        <td><%= user.getId() %></td>
        <td><%= user.getName() %></td>
        
        
  
        <td>
          <button onclick="location.href='../View_Msg/resetpsw.jsp?id=<%= user.getId() %>'">更改密码</button>
        </td>
      </tr>
      <%
          }
        } else {
      %>
      <tr>
        <td colspan="3">没有找到个人信息</td>
      </tr>
      <%
        }
      %>
      <!-- 错误显示： -->
      <%
        String error = (String) request.getAttribute("error");
        if (error != null) {
      %>
      <tr>
        <td colspan="3" style="color:red"><%= error %></td>
      </tr>
      <%
        }
      %>
    </tbody>
  </table>
</div>
 

</body>
</html>